target: app

include ../../makeconf

OBJ_PATH 	= .
BIN_OUTPUT 	= $(BIN_OUTPUT_PATH)/webrouter$(BIN_EXTNAME)

ALLSRC = $(wildcard src/*.c) $(wildcard src/*.cpp)
ALLOBJ = $(patsubst %.c, $(OBJ_PATH)/%.o, $(filter %.c, $(ALLSRC))) \
		 $(patsubst %.cpp, $(OBJ_PATH)/%.o, $(filter %.cpp, $(ALLSRC)))

INCPATH += $(INC_OPENSSL)
LIBLINK += $(LIB_OPENSSL)

$(OBJ_PATH)/%.o:%.c
	$(GCC) $(INCPATH) -c -o $@ $<
	
$(OBJ_PATH)/%.o:%.cpp
	$(CPP) $(INCPATH) -c -o $@ $<

clean:
	@$(DELETEFILE) $(OBJ_PATH)/src/*.o

app:$(ALLOBJ)
	$(CPP) -o $(BIN_OUTPUT) $(ALLOBJ) -L$(LIB_OUTPUT_PATH) -lhttp -lzlib -ljson -ldbx.base $(LIBLINK)

gdb:
	@$(GDB) $(BIN_OUTPUT)

run:
	@$(BIN_OUTPUT) config.lua -l